import { useModel } from "@umijs/max";
export default (initialState: API.UserInfo) => {
  // 在这里按照初始化数据定义项目中的权限，统一管理
  // 参考文档 https://umijs.org/docs/max/access
  const canSeeAdmin = !!(
    initialState && initialState.name !== 'dontHaveAccess'
  );
  function login(){
	console.log(`initialState.role:`,initialState.role)
	return initialState.role==="user";
  }
  return {
    canSeeAdmin,
	user:login,
	admin(){
		return initialState.role==="admin";
	  }
  };
};
